/*client1.c*/
#include<stdio.h>
#include<stdlib.h>
#include<sys/stat.h>
#include<unistd.h>
#include<linux/stat.h>
#define FIFO_S "serget"
int main()
{
    FILE *fp;
    int i;
    char writebuf[50]="client1 link";
    while(1)
    {
        if((fp=fopen(FIFO_S,"w"))==NULL)
        {
            printf("open fifo failed.\n");
            exit(1);
        }
    
        printf("please input.\n");
        scanf("%s",writebuf);
        printf("writebuf=%s\n",writebuf);
        //fputs(writebuf,fp);
        if(fputs(writebuf,fp)==EOF)
        {
            printf("write  fifo error.\n");
            exit(1);
        }
        else
            printf("ok");            
        //usleep(200000);
        fclose(fp);
        usleep(200000);
    }
    return 0;
}
